import api from './index'

// 获取用户信息
export const getUserInfo = (userId = null) => {
  if (userId) {
    return api.get(`user/info/${userId}`)
  }
  return api.post('user/info')
}

// 更新用户信息
export const updateUserInfo = (data) => {
  return api.post('user/wx_info', data)
}

// 绑定手机号
export const bindMobile = (data) => {
  return api.post('user/bind_mobile', data)
}

// 微信登录
export const wechatLogin = (data) => {
  return api.post('user/wechat_login', data)
}

// 邮箱注册
export const register = (data) => {
  return api.post('user/register', data)
}

// 获取用户积分统计
export const getPointsStats = () => {
  return api.get('points/stats')
}

// 获取积分记录
export const getPointsRecords = (params = {}) => {
  return api.get('points/records', { params })
}

// 获取积分记录详情
export const getPointsRecordDetail = (id) => {
  return api.get(`points/records/${id}`)
} 

// 获取用户收款码信息
export const getUserQrcode = () => {
  return api.post('user/get_bank_info')
}

// 更新用户收款码信息
export const updateUserQrcode = (data) => {
  return api.post('user/update_bank_info', data)
}

// 提交用户审核
export const submitUserAudit = (data) => {
  return api.post('user/submit-audit', data)
}

// 获取用户审核信息
export const getUserAuditInfo = () => {
  return api.get('user/audit-info')
} 